<template>
  <div class="main_box" style="padding:10px;">
    <div class="detail_wrap">
      <div class="tit">
        <h2>基础信息</h2>
        <el-button plain size="small" type="success" icon="fa fa-mail-forward" @click="returnList"> 返 回</el-button>
      </div>
      <div class="con">
        <ul>
          <li>
            <label class="label">挂号编号</label>
            <span>{{dataInfo.referralCode}}</span>
          </li>
          <li>
            <label class="label">挂号医院</label>
            <span>{{dataInfo.institutionName}}</span>
          </li>
          <li>
            <label class="label">挂号科室</label>
            <span>{{dataInfo.insOfficeName}}</span>
          </li>
          <li>
            <label class="label">挂号医生</label>
            <span>{{dataInfo.doctorName}}</span>
          </li>
          <li>
            <label class="label">挂号日期</label>
            <span>{{formatDate(dataInfo.referralDate)}}</span>
          </li>
          <!--<li>
            <label class="label">挂号时间段</label>
            <span>{{dataInfo.referralTime}}</span>
          </li>-->
          <li>
            <label class="label">挂号状态</label>
            <span>{{formatReferralState(dataInfo.referralState)}}</span>
          </li>
          <li>
            <label class="label">挂号成功时间</label>
            <span>{{dataInfo.referralSuccessTime}}</span>
          </li>
          <li>
            <label class="label">挂号完成时间</label>
            <span>{{dataInfo.referralEndTime}}</span>
          </li>
          <li>
            <label class="label">取消失败原因</label>
            <span>{{dataInfo.cancelMsg}}</span>
          </li>
          <li>
            <label class="label">挂号备注</label>
            <span>{{dataInfo.remark}}</span>
          </li>
        </ul>
      </div>

      <div class="tit">
        <h2>患者信息</h2>
      </div>
      <div class="con">
        <ul>
          <li>
            <label class="label">患者姓名</label>
            <span>{{dataInfo.patientName}}</span>
          </li>
          <li>
            <label class="label">患者性别</label>
            <span v-if="dataInfo.patientSex == 1">男</span>
            <span v-else-if="dataInfo.patientSex == 2">女</span>
          </li>
          <li>
            <label class="label">患者年龄</label>
            <span>{{dataInfo.patientAge}}</span>
          </li>
          <li>
            <label class="label">患者电话</label>
            <span>{{dataInfo.patientPhone}}</span>
          </li>
          <li>
            <label class="label">患者身份证</label>
            <span>{{dataInfo.patientCard}}</span>
          </li>
          <li>
            <label class="label">患者病史</label>
            <span>{{dataInfo.patientInfo}}</span>
          </li>
        </ul>
      </div>

    </div>
  </div>
</template>

<script>
import ReferralApi from "@/api/referral/referral";
export default {
  data() {
    return {
      dataInfo: ""
    };
  },
  methods: {
    getData() {
      ReferralApi.getReferralInfo({
        referralId: this.$route.query.id
      }).then(res => {
        this.dataInfo = res.data;
      });
    },
    formatDate(value) {
      return this.$Utils.formatDate(value, "yyyy-MM-dd");
    },
    formatReferralState (cellValue) {
      if (cellValue === 1) {
        return '挂号中'
      } else if (cellValue === 10) {
        return '协商中'
      } else if (cellValue === 20) {
        return '挂号成功'
      } else if (cellValue === 30) {
        return '已取消'
      } else if (cellValue === 40) {
        return '待确认取消'
      } else if (cellValue === 50) {
        return '待确认修改'
      } else if (cellValue === 60) {
        return '已就诊'
      }
    },
    returnList() {
      this.$store.dispatch('delView', this.$route);
      this.$router.push({ path: "/referral/referralManagement" });
    }
  },
  mounted() {
    this.getData();
  }
};
</script>
<style lang="scss" src="@/assets/css/views/Detail.scss" scope>
</style>
